#include "startmenu.h"
#include<QApplication>

StartMenu::StartMenu(QWidget *parent):QWidget(parent) {
    QVBoxLayout *layout=new QVBoxLayout(this);

    //创建按钮
    startButton=new QPushButton("开始游戏",this);
    exitButton=new QPushButton("退出",this);

    startButton->setStyleSheet("QPushButton{font-size:24px;padding:10px;}");
    exitButton->setStyleSheet("QPshButton{font-size:24px;padding:10 px;}");

    layout->addWidget(startButton);
    layout->addWidget(exitButton);

    connect(startButton,&QPushButton::clicked,this,&StartMenu::onStartClicked);
    connect(exitButton,&QPushButton::clicked,qApp,&QApplication::quit);


}

void StartMenu::onStartClicked(){
    emit startGame();
    this->close();

}
